using System;

namespace SharpMud.Net
{
	/// <summary>
	/// Defines the functionality of a simple network connection
	/// </summary>
	public interface INetworkConnection : System.Threading.IRequiresExternalPulsing, IDisposable
	{
		/// <summary>
		/// The stream of input and output for the connection
		/// </summary>
		System.IO.Stream				Stream				{get;}

		/// <summary>
		/// Accept the connection
		/// </summary>
		void Accept();
		/// <summary>
		/// Close the connection
		/// </summary>
		void Close();

		/// <summary>
		/// The current status of the network connection
		/// </summary>
		ConnectionStatus				Status				{get;}

		/// <summary>
		/// The time that this connection was accepted
		/// </summary>
		System.DateTime					ConnectTime			{get;}

		/// <summary>
		/// The local IP endpoint for the network connection
		/// </summary>
		System.Net.IPEndPoint			LocalEndpoint		{get;}
		/// <summary>
		/// The remote IP endpoint for the network connection
		/// </summary>
		System.Net.IPEndPoint			RemoteEndpoint		{get;}

		/// <summary>
		/// This event is raised if the network connection object has determined that
		/// the link was lost
		/// </summary>
		event ConnectionEventHandler	LinkLost;
		/// <summary>
		/// This event is raised as soon as the network connection has been started to close
		/// </summary>
		event ConnectionEventHandler	Closing;
		/// <summary>
		/// This event is raised as soon as the connection is accepted
		/// </summary>
		event ConnectionEventHandler	Connected;
		/// <summary>
		/// This event is raised after the network connection has been disconnected
		/// </summary>
		event ConnectionEventHandler	Disconnected;
    }
}
